<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-money" data-rule="required" class="form-control" step="0.01" name="row[money]" type="number" value="{$row.money|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Limit')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-limit" data-rule="required" class="form-control" step="0.01" name="row[limit]" type="number" value="{$row.limit|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Grant_nums')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-grant_nums" data-rule="required" class="form-control" name="row[grant_nums]" type="number" value="{$row.grant_nums|htmlentities}">
            <p class="text-gray" style="margin-top: 5px;">{:__('Reminder: Set to -1 to unlimited quantity')}</p>
        </div>
    </div>
<!--    <div class="form-group">-->
<!--        <label class="control-label col-xs-12 col-sm-2">{:__('Provide_nums')}:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->
<!--            <input id="c-provide_nums" class="form-control" name="row[provide_nums]" type="number" value="{$row.provide_nums|htmlentities}">-->
<!--        </div>-->
<!--    </div>-->
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Draw_limit')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-draw_limit" data-rule="required" class="form-control" name="row[draw_limit]" type="number" value="{$row.draw_limit|htmlentities}">
            <p class="text-gray" style="margin-top: 5px;">{:__('Reminder: If set to 0, there is no limit on the number of claims')}</p>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Validity_type')}:</label>
        <div class="col-xs-12 col-sm-8">
                        
<!--            <select  id="c-validity_type" class="form-control selectpicker" name="row[validity_type]">-->
<!--                {foreach name="validityTypeList" item="vo"}-->
<!--                    <option value="{$key}" {in name="key" value="$row.validity_type"}selected{/in}>{$vo}</option>-->
<!--                {/foreach}-->
<!--            </select>-->

            <div class="radio">
                {foreach name="validityTypeList" item="vo"}
                <label for="row[validity_type]-{$key}"><input id="row[validity_type]-{$key}" name="row[validity_type]" type="radio" value="{$key}" {in name="key" value="$row.validity_type"}checked{/in} /> {$vo}</label>
                {/foreach}
            </div>

        </div>
    </div>
    <div class="form-group validity_days-content {if condition='$row.validity_type == 0'}hidden{/if}">
        <label class="control-label col-xs-12 col-sm-2">{:__('Validity_days')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-validity_days" class="form-control" name="row[validity_days]" type="number" value="{$row.validity_days|htmlentities}">
            <p class="text-gray" style="margin-top: 5px;">{:__('Note: If you set it to 0, it will not expire')}</p>
        </div>
    </div>
    <div class="validity_time-content {if condition='$row.validity_type == 1'}hidden{/if}">
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('Start_time')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-start_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[start_time]" type="text" value="{:$row.start_time?datetime($row.start_time):date('Y-m-d H:i:s')}">
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('End_time')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-end_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[end_time]" type="text" value="{:$row.end_time?datetime($row.end_time):date('Y-m-d H:i:s',time()+86400*7)}">
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            
            <div class="radio">
            {foreach name="statusList" item="vo"}
            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label> 
            {/foreach}
            </div>

        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Available_type')}:</label>
        <div class="col-xs-12 col-sm-8">

            <div class="radio">
                {foreach name="availableTypeList" item="vo"}
                <label for="row[available_type]-{$key}"><input id="row[available_type]-{$key}" name="row[available_type]" type="radio" value="{$key}" {in name="key" value="$row.available_type"}checked{/in} /> {$vo}</label>
                {/foreach}
            </div>

        </div>
    </div>

    <div class='range_type-group {eq name="$row.available_type" value="all"}hidden{/eq}'>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('Range_type')}:</label>
            <div class="col-xs-12 col-sm-8">

                <div class="radio">
                    {foreach name="rangeTypeList" item="vo"}
                    <label for="row[range_type]-{$key}"><input id="row[range_type]-{$key}" name="row[range_type]" type="radio" value="{$key}" {in name="key" value="$row.range_type"}checked{/in} /> {$vo}</label>
                    {/foreach}
                </div>

            </div>
        </div>

       <div class='appoint_goods-group {neq name="$row.available_type" value="mall"}hidden{/neq}'>
           <div class='form-group appoint_goods-group {eq name="$row.range_type" value="all"}hidden{/eq}'>
               <label class="control-label col-xs-12 col-sm-2">{:__('Appoint goods')}:</label>
               <div class="col-xs-12 col-sm-8">
                   <button type="button" class="btn btn-info btn-appoint_goods">{:__('Add goods')}</button>
                   <table id="table_goods" class="table table-striped table-bordered table-hover table-nowrap" style="margin-top: 10px;">
                   </table>
               </div>
           </div>
       </div>

        <div class='appoint_product-group {neq name="$row.available_type" value="reservation"}hidden{/neq}'>
            <div class='form-group appoint_product-group {eq name="$row.range_type" value="all"}hidden{/eq}'>
                <label class="control-label col-xs-12 col-sm-2">{:__('Appoint product')}:</label>
                <div class="col-xs-12 col-sm-8">
                    <button type="button" class="btn btn-info btn-appoint_product">{:__('Add product')}</button>
                    <table id="table_product" class="table table-striped table-bordered table-hover table-nowrap" style="margin-top: 10px;">
                    </table>
                </div>
            </div>
        </div>
    </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
        </div>
    </div>
</form>

<script>
    var rangGoods = {$row.range_goods ? $row.range_goods : "''"};

    var rangProduct = {$row.range_reservation ? $row.range_reservation : "''"};
</script>